//
//  MoreOptionalVC.m
//  FindJob
//
//  Created by 233 on 16/2/29.
//  Copyright © 2016年 Lee. All rights reserved.
//

#import "MoreOptionalVC.h"
#import "imageCell.h"

static NSString *const kSystemSetupVc = @"SystemSetupVc";
static NSString *const kReuseableCellIdentifier = @"imagecell";

static NSString *const kAboutUsVC = @"AboutUsVC";
@interface MoreOptionalVC ()<UITableViewDataSource,UITableViewDelegate>



@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic, copy) NSArray *imagesArr;

- (void)initializeDataSource;     /**< 初始化数据源 */
- (void)initializeUserIntefcace;  /**< 初始化用户界面 */

@end

@implementation MoreOptionalVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initializeDataSource];
    [self initializeUserIntefcace];
}
- (void)initializeDataSource{
 
    _imagesArr = @[[UIImage imageNamed:@"more_系统设置"],[UIImage imageNamed:@"more_应用分享"],[UIImage imageNamed:@"more_新手帮助"],[UIImage imageNamed:@"more_意见反馈"],[UIImage imageNamed:@"more_关于我们"]];
    
}
- (void)initializeUserIntefcace{
    
    UINib *imageCellNib = [UINib nibWithNibName:NSStringFromClass([imageCell class]) bundle:nil];
    [self.tableView registerNib:imageCellNib forCellReuseIdentifier:kReuseableCellIdentifier];
    
    
}
#pragma mark - UITableViewDataSource,UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _imagesArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    imageCell *cell = [tableView dequeueReusableCellWithIdentifier:kReuseableCellIdentifier];
    cell.imageView.image = _imagesArr[indexPath.row];
   
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        [self performSegueWithIdentifier:kSystemSetupVc sender:self];
    }else if (indexPath.row == 1){
//        [self showAlertViewWithTitle:@"分享到" target:self];
    }else if (indexPath.row == 2){
        
    }else if (indexPath.row == 3){
        
    }else{
        [self performSegueWithIdentifier:kAboutUsVC sender:self];
    }
}

-(void)showAlertViewWithTitle:(NSString *)title target:(id _Nonnull)target {
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertView *alertView = [[UIAlertView alloc] initWithFrame:CGRectMake(10, 64 + 100, self.view.bounds.size.width - 20, 200)];
    alertView.backgroundColor = [UIColor orangeColor];
  
    
    [alertView show];
    [target presentViewController:alertController animated:YES completion:nil];
    
}
@end
